# Contributor: Thomas Deutsch <thomas@tuxpeople.org>
# Maintainer: Thomas Deutsch <thomas@tuxpeople.org>
pkgname=kube-no-trouble
_pkgname=github.com/doitintl/kube-no-trouble
pkgver=0.7.3
pkgrel=0
pkgdesc="Easily check your clusters for use of deprecated APIs"
url="https://github.com/doitintl/kube-no-trouble"
arch="all"
license="MIT"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/doitintl/kube-no-trouble/archive/refs/tags/$pkgver.tar.gz"
options="net"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local ldflags="
	-X main.version=$pkgver
	-X $_pkgname/cmd.version=$pkgver
	-X $_pkgname/cmd.commit=AlpineLinux
	-X $_pkgname/cmd.date=$(date -u +%FT%T%Z ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
	"
	go build -ldflags "$ldflags" -o execs/$pkgname cmd/kubent/main.go
}

check() {
	go test ./...
}

package() {
	install -Dm755 execs/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
64f87733f8e5c50219a58b57aa13cbb87daa4a00a0743d303f08db1f7e1301abf50880fb13eae152627ac487efbfe712756f8260d372677714db15696c8bbcef  kube-no-trouble-0.7.3.tar.gz
"
